package com.cdcas;

import java.util.Objects;

public class Book3 {
    private String titile;
    private String author;
    private double price;

    public Book3(String title,String author,double price) {
        this.author = author;
        this.titile = title;
        this.price = price;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() !=obj.getClass()) {
            return false;
        }
        Book3 book3 = (Book3) obj;
        return Double.compare(book3.price,price) ==0 &&
                titile.equals(book3.titile) && author.equals(book3.author);
    }

    @Override
    public int hashCode() {
        return Objects.hash(titile,author,price);
    }

    @Override
    public String toString() {
        return "Book3{" +
                "titile='" + titile + '\'' +
                ", author='" + author + '\'' +
                ", price=" + price +
                '}';
    }
}
